<template>
  <div class="head-box">
    <button class="menu-arrow" @click="drawer.visible=true" @mouseleave="onMenuArrowMouseLeave"
            @mouseenter="onMenuArrowMouseEnter">
      <i class="el-icon-s-unfold"></i>
    </button>
    <el-drawer
        :visible.sync="drawer.visible"
        :direction="drawer.direction"
        :destroy-on-close="drawer.destoryOnClose"
        :append-to-body="drawer.appendToBody"
        :modal-append-to-body="drawer.modalAppendToBody"
        @opened="openedHandler"
        :with-header="false">
      <div style="width: 400px;">
        <div style="width: 400px;height: 30px;background-color: #3a8ee6">
        </div>
        <div style="width: 400px;height: 30px;background-color: #3a8ee6"></div>
      </div>
    </el-drawer>
  </div>
</template>
<script>
define(['vue', "loader!app/Head"], function (Vue) {
  Vue.component("m_head", {
    template: template,
    data() {
      return {
        drawer: {
          visible: false,
          destoryOnClose: true,
          modalAppendToBody: false,
          appendToBody: false,
          direction: 'ltr'
        },
        activeIndex: this.$root.$route.path
      };
    },
    components: {},
    methods: {
      onMenuArrowMouseEnter() {
        let that = this;
        this.timeoutHandle = setTimeout(function () {
          that.drawer.visible = true;
        }, 500)
      },
      onMenuArrowMouseLeave() {
        clearTimeout(this.timeoutHandle);
      },
      openedHandler: function (content) {
        let test = document.querySelector(".testxx");
        test.style.width = "none"
        console.log(test);
      }
    }
  })
});
</script>
<style>
.head-box > .v-modal, .head-box > .el-drawer__wrapper, .head-box > .el-drawer__wrapper > .el-drawer__container {
  top: 50px;
}


.head-box > .v-modal {
  opacity: .2;
  background: #000;
}

.menu-arrow {
  width: 50px;
  height: 50px;
  line-height: 50px;
  box-sizing: border-box;
  line-height: inherit;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  display: inline-block;
  vertical-align: middle;
  text-align: center;
  color: rgb(85, 85, 85);
  white-space: nowrap;
  padding: 0px;
  outline: medium;
  background: none rgb(255, 106, 0);
  text-decoration: none;
  transition: all 0.3s ease-out 0s;
  border-width: initial;
  border-style: none;
  border-color: initial;
  border-image: initial;
  overflow: hidden;
}
</style>